package com.qfedu.java1234.common.exception;

import com.qfedu.java1234.entity.vo.ResultVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @ClassName GlobalExceptionHandler
 * @Author ykx
 * @Date 2024/4/21 21:33
 * @Version 1.0
 */
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(value = RuntimeException.class)
    public ResultVO handler(RuntimeException e) {
        log.error("运行时异常：----------------{}", e.getMessage());
        System.out.println("运行时异常：");
        return ResultVO.failed(e.getMessage());
    }
}
